package com.sykj.bsc.rwl.service.Impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sykj.bsc.jhy.entity.Bis_nurse_project;
import com.sykj.bsc.rwl.mapper.SubsrcibeMapper;
import com.sykj.bsc.rwl.service.SubsrcibeService;
import com.sykj.bsc.rwl.vo.SubsrcibeVo;
import com.sykj.bsc.zjj.bean.Bis_custom_user;
@Service("subsrcibeService")
public class SubsrcibeServiceImpl implements SubsrcibeService{
	
	@Autowired
	private SubsrcibeMapper subsrcibeMapper;
	
	//查询该店铺的所有商家带预约客户的项目
	public List<Map<String, Object>> selectSubsrcibe(HashMap<String, Object> map) {
		return subsrcibeMapper.selectSubsrcibe(map);
	}

	@Override
	public void saveSubsrcibe(SubsrcibeVo subsrcibeVo) {
		String mobile=subsrcibeVo.getMobile();
		Bis_custom_user b=subsrcibeMapper.selectCustom(mobile);
		subsrcibeVo.setCustom_user_id(b.getCustom_user_id());
		String order_id=subsrcibeMapper.getId();
		subsrcibeVo.setOrder_id(order_id);
		System.out.println(subsrcibeVo.toString());
		subsrcibeMapper.saveSubsrcibe(subsrcibeVo);
	}

	@Override
	public List<Map<String,Object>>  selectNurseProject() {
		return subsrcibeMapper.selectNurseProject();
	}

	@Override
	public Bis_nurse_project checkProject(String project_id) {
		return subsrcibeMapper.checkProject(project_id);
	}

	@Override
	public boolean selectCustom(String mobile) {
		Bis_custom_user b=subsrcibeMapper.selectCustom(mobile);
		if(b==null) {
			return false;
		}
		return true;
	}
}
